package com.financing.platform.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.financing.platform.dao.ISalesPrizesDao;
import com.financing.platform.dto.SalesPrizesDTO;
import com.financing.platform.service.ISalesPrizesService;
/**
 * sales_prizes  
 * 奖项配置表 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("salesPrizesService")
public class SalesPrizesServiceImpl implements ISalesPrizesService{

	@Autowired
	private ISalesPrizesDao salesPrizesDao;

	@Override
	public int insert(SalesPrizesDTO salesPrizes) throws SQLException {
		return salesPrizesDao.insert(salesPrizes);
	}

	@Override
	public void update(SalesPrizesDTO salesPrizes) throws SQLException {
		salesPrizesDao.update(salesPrizes);
	}

	@Override
	public void updateForce(SalesPrizesDTO salesPrizes) throws SQLException {
		salesPrizesDao.updateForce(salesPrizes);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		salesPrizesDao.delete(id);
	}
	
	@Override
	public List<SalesPrizesDTO> queryList(SalesPrizesDTO salesPrizes) throws SQLException {
		return salesPrizesDao.queryList(salesPrizes);
	}

	@Override
	public int queryListCount(SalesPrizesDTO salesPrizes) throws SQLException {
		return salesPrizesDao.queryListCount(salesPrizes);
	}

	@Override
	public SalesPrizesDTO loadById(Integer id) throws SQLException {
		return salesPrizesDao.loadById(id);
	}
 	@Override
	public SalesPrizesDTO queryListGetFirst(SalesPrizesDTO salesPrizes)
			throws SQLException {
		 List<SalesPrizesDTO> queryList = queryList(salesPrizes);
		 if(queryList==null||queryList.size()==0){
			 return new SalesPrizesDTO();
		 }
		 return queryList.get(0);
	}
}
